﻿if exists (select * from sysobjects where name like N'%sp_DMDonViTinh_Insert%')
	drop proc sp_DMDonViTinh_Insert
go
create proc sp_DMDonViTinh_Insert
	@MaCode varchar(20) = null,
	@TenDonViTinh nvarchar(50) = null,
	@IsUse bit = null,
	@CreateBy int = null
as
begin
	if not exists (select * from DMDonViTinh where MaCode= @MaCode)
	begin	
		insert into DMDonViTinh (MaCode,TenDonViTinh, IsUse, CreateBy)
			values (@MaCode, @TenDonViTinh, @IsUse, @CreateBy)
		return 1
	end
	else
	begin
		return 0
	end
end